# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Marcin (CTRL) Wieczorek <marcin@marcin.co>
# Contributor: Jeffrey Tolar <tolar.jeffrey at gmail dot com>

pkgname=verilator
pkgver=5.018
pkgrel=1
pkgdesc='The fastest free Verilog HDL simulator'
url='https://www.veripool.org/projects/verilator/wiki/Intro'
arch=('loong64' 'x86_64')
license=('LGPL')
depends=('perl')
optdepends=('systemc')
# lsb-release is used by configure script to enable usage of c++17
makedepends=('help2man' 'python' 'systemc' 'lsb-release')
source=("https://github.com/verilator/verilator/archive/v$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('671d6d5fa749b00f0e66cdf17f0b8c38523f757e4c33268ee4805e131b38bc6563ffa312827fa547c5f3efb9c539633e412d8e105742ac2f4713e21b43f67ce8')

prepare() {
  cd verilator-$pkgver
  autoconf
}

build() {
  cd verilator-$pkgver
  ./configure --prefix=/usr
  make
}

check() {
  cd verilator-$pkgver
  make test
}

package() {
  cd verilator-$pkgver
  make install DESTDIR="$pkgdir"
}
